package Server;
/*comment about file*/
import java.util.LinkedList;

/**
 * DailyAppointment class that creates a list of appointments within one day
 * @author Justin
 *
 * @version $Revision: 1.0 $
 */

public class DailyAppointment {
/**
 * Field apptList.
 */
private final LinkedList<Appointments> apptList;

/**
 * Field day.
 */
private int day;

	/**
	 * Method toString.
	 * @return String
	 */
	public String toString(){
	final String str = "";
	return str;
	}
	
	/**
	 * Method getApptList.
	 * @return LinkedList<Appointments>
	 */
	public LinkedList<Appointments> getApptList(){
		return apptList;
	}
	
	/**
	 * Constructor for DailyAppointment.
	 * @param day int
	 */
	public DailyAppointment(int day){
		apptList = new LinkedList<Appointments>();
		this.day = day;
	}
	
	/**
	 * Getter for day
	
	 * @return int
	 */
	public int getDay(){
		return day;
	}
	
	/**
	 * Add appointment method
	 * Adds an appointment if the appointment at that time does not exist
	 * Else returns false
	 * @param appt
	
	 * @return boolean
	 */
	public boolean canAddAppt(Appointments appt){
		if(apptList.isEmpty()){
			apptList.add(appt);
			return true;
		}
		for(Appointments check : apptList){
			if(check.getGc().equals(appt.getGc()))
				return false;
		}
		apptList.add(appt);
		return true;
	}
	
	/**
	 * Finds the specified appointment to delete
	 * Else returns false
	 * @param appt
	
	 * @return boolean
	 */
	public boolean canRemoveAppt(Appointments appt){
		if(apptList.isEmpty()) return false;
		for(Appointments check : apptList){
			if(check.getGc().equals(appt.getGc())){
				apptList.remove(check);
				return true;
			}
		}
		return false;
	}
	
	
}
